package Day05;

import java.util.Arrays;

public class Text5 {
    public static void main(String[] args) {
        //冒泡排序
        int[] arr = {1,5,2,3,11,4};
        BubbleSort(arr);
        System.out.println(Arrays.toString(arr));


    }

    public static int[] BubbleSort(int[] a){
        for (int i = 0; i < a.length - 1; i++) {
           for(int j = 0; j < a.length -1 -i; j++){
               if(a[j] > a[ j+ 1]){
                   int temp = a[j];
                   a[j] = a[j + 1];
                   a[j +1] = temp;
               }
           }
        }
        return a;
    }
}
